/*
 * Copyright (C) Jahia Ltd. All rights reserved.
 *
 * This software is published under the terms of the Jahia Open Software
 * License version 1.1, a copy of which has been included with this
 * distribution in the LICENSE.txt file.
 */
package org.jahia.sqlprofiler.gui;

import javax.swing.JLabel;
import javax.swing.*;

/**
 * <p>Title: SQL Profiler</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: Jahia Ltd</p>
 * @author Serge Huber
 * @version 1.0
 */

public class StatusLabel extends JLabel {

    private boolean statusActivated = false;
    private Icon statusDeactivatedIcon;
    private Icon statusActivatedIcon;

    public StatusLabel() {
        super();
        java.net.URL statusOffURL = ClassLoader.getSystemResource("icons/statusRed.gif");
        statusDeactivatedIcon = new ImageIcon(statusOffURL, "Status Off");
        java.net.URL statusOnURL = ClassLoader.getSystemResource("icons/statusGreen.gif");
        statusActivatedIcon = new ImageIcon(statusOnURL, "Status On");
        setIcon(statusDeactivatedIcon);
    }

    public boolean isStatusActivated() {
        return statusActivated;
    }

    public void setStatusActivated(boolean statusActivated) {
        this.statusActivated = statusActivated;
        if (isStatusActivated()) {
            setIcon(statusActivatedIcon);
        } else {
            setIcon(statusDeactivatedIcon);
        }
    }

}